#include "MainWindow.h"
#include "VFunctions.h"
#include "VFolderData.h"
#include "VGlobal.h"
#include "wke.h"

#include <QApplication>
#include <QDebug>
#include <QSettings>
#include <QAction>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonDocument>


//void registerDefault(){
//	QSettings* ukenvFileReg = new QSettings("HKEY_CLASSES_ROOT\\.{fileType}", QSettings::NativeFormat);   //
//
//	//判断UKEnv类型是否已在注册表中，并关联了正确的打开方式（程序打开方式），没有则写入
//	QString currentValue = ukenvFileReg->value("Default").toString();
//
//	if (currentValue.isEmpty() ||
//		currentValue != "{Program_Type}")
//	{
//		//QMessageBox::information(NULL,"information","Unregistered or Uncorrect");
//		ukenvFileReg->setValue("Default", "{Program_Type}");
//		QSettings* ukenvIconReg = new QSettings("HKEY_CLASSES_ROOT\\.{fileType}\\DefaultIcon", QSettings::NativeFormat);
//		ukenvIconReg->setValue("Default", QString(qApp->argv()[0]) + ",0");   //将当前运行的程序图标置入
//		delete ukenvIconReg;
//
//		QSettings* ukenvProgramReg = new QSettings("HKEY_CLASSES_ROOT\\{Program_Type}\\shell\\open\\command", QSettings::NativeFormat);
//		ukenvProgramReg->setValue("Default", QString(qApp->argv()[0]) + " %1"); //将当前运行的程序路径置入
//
//		delete ukenvProgramReg;
//	}
//	delete ukenvFileReg;
//}


寒山 - 居士
Bbs5
void QSettings::setValue(const QString& key, const QVariant& value)
Sets the value of setting key to value.If the key already exists, the previous value is overwritten.
参考以下
//插入安装程序的注册表项
QSettings* settings1 = new QSettings("HKEY_CLASSES_ROOT\\Installer\\", QSettings::NativeFormat);
QString strIcoPath = Global::g_homePath + "/" + CmString::strAppIconName + ",0";
settings1->setValue(".", CmString::strAndroidApk);
strIcoPath.replace("/", "\\");
settings1->setValue("DefaultIcon/.", strIcoPath);
settings1->setValue("shell/.", "open");
settings1->setValue("shell/open/.", "APk安装程序");
QString cmd = "\"" + Global::g_homePath + "/ApkTool.exe\" -path=\"%1\"";
cmd.replace("/", "\\");
settings1->setValue("shell/open/command/.", cmd);
delete settings1;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
	
	/*QTextCodec::setCodecForLocale(QTextCodec::codecForName("GB2312"));
	QString str1 = "aaaaaaaaaaaa中文测试";
	std::string str = str1.toStdString();*/
    wkeInitialize();
    // 初始化路径
    VFunctions::init_path();
    VFunctions::load_setting();
    VFunctions::init_keyword_map();
    a.setFont(QFont(VGlobal::setting.app_font_name, 9));
    // 注册MessageHandler
    // qInstallMessageHandler(VFunctions::outputMessage);

    VGlobal::version = "1.4";
    MainWindow w;
    w.show();

    return a.exec();
}


